<?php
/* @var $this SiteController */

$this->layout = '//layouts/site_view';
$this->pageTitle=$model->title;
$this->category = $model->type->name;

$this->weiboCommend = array(
    'type'=>'webpage',
    'title'=>$model->title,
    'description'=> HelperString::sysSubStr(strip_tags($model->description), 300, true),
    'url'=>Yii::app()->request->hostInfo.Yii::app()->createUrl('site/view',array('id'=>$model->id)),
    'createDate'=>$model->create_date,
    'updateDate'=>$model->update_date
    
);

$this->metaArgs = array(
    'keywords'=>$model->title,
    'description'=> HelperString::sysSubStr(strip_tags($model->description), 300, true)
);

//添加js代码
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/scroll-top.js', CClientScript::POS_END);
?>

<div class='container-fluid'>
	
	<div class='row-fluid'>
		<div class='span9 left-container'>
            <div class="">
                <?php $this->beginWidget('AmazonWidget',array('category'=>$this->category));$this->endWidget();?>
            </div>
			
			<section class='well'>
				<h4>
					<a title='<?php echo $model->title;?>' href='<?php echo Yii::app()->createUrl('site/view',array('id'=>$model->id));?>'>
						<?php echo $model->title;?>
					</a>
				</h4>
				<div class='divider'></div>
				<div class='tips' style='float: left;width:100%'>
					<section style='display:inline;float:left'>
						<span>
							<strong>作者:</strong>
						</span>
						<span class='label'>
							<?php echo $model->user->username;?>
						</span>
					</section>
					<section style='display:inline;float:left'>
						<span class=''>|</span>
					</section>
					<section style='display:inline;float:left'>
						<span>
							<strong>时间:</strong>
						</span>
						<span class='label'>
							<?php echo $model->create_date;?>
						</span>
					</section>
					<section style='display:inline;float:left'>
						<span class=''>|</span>
					</section>
					<section style='display:inline;float:left'>
						<span>
							<strong>标签:</strong>
						</span>
						<span>
		                <?php if(!empty($model->tag)):?>
			                <?php $tagArr = preg_split('#,|，#i',$model->tag);?>
		                    <?php foreach($tagArr as $k=>$v):?>
		                        <span class="label label-inverse">
		                            <?php $key =  preg_replace('#\.#','#dotted#',urlencode($v));?>
		                            <span class='label'>
										<a target="_blank" href='<?php echo Yii::app()->createUrl('site/tag',array('tag'=>$key));?>'>
											<?php echo trim($v);?>
										</a>
									</span>
		                        </span>
		                    <?php endforeach;?>
						<?php endif;?>
						</span>
					</section>
					
					<section style='display:inline;float:right'>
						<span style='float: left'>
							<wb:like appkey="1311991711" type="number"></wb:like>
						</span>
					</section>
				</div>
				<div class='' style='clear: left'></div>
				<div class='divider'></div>
				<div class='content'>
					<?php echo $model->description;?>
				</div>
				<div class='divider'></div>
				<!-- 是否是转载 -->
                <div class="well-small">
                <?php if(!empty($model->source_url)):?>
                    <strong>
                    	<span class="fui-user"></span> 转载:<?php echo $model->source_url;?>
                    </strong>
                <?php else:?>
                	<strong>
                    	<span class="fui-user"></span> 原创作品:<a href='<?php echo Yii::app()->createUrl('site/view',array('id'=>$model->id));?>' target='_blank'><?php echo Yii::app()->request->hostinfo.Yii::app()->createUrl('site/view',array('id'=>$model->id));?></a>
                	</strong>
                <?php endif;?>
                </div>
				
			</section>
			<section>
				<div class='divider'></div>
				<?php if(!empty($prev)):?>
					<div><strong>上一篇 </strong>
						<a href='<?php echo Yii::app()->createUrl('site/view',array('id'=>$prev->id));?>'>
							<?php echo $prev->title;?>
						</a>
					</div>
				<?php endif;?>
                <?php if(!empty($next)):?>
					<div>
						<strong>下一篇 </strong>
						<a href='<?php echo Yii::app()->createUrl('site/view',array('id'=>$next->id));?>'>
							<?php echo $next->title;?>
						</a>
					</div>
                <?php endif;?>
				<div class='divider'></div>
			</section>
			
			<div class='divider'></div>
			<section style='height: 30px'>
				<?php $this->beginWidget('JiaThisShareWidget');?><?php $this->endWidget();?>
			</section>
			<div class='divider'></div>
			<div class='divider'></div>
			<section style='min-height: 30px'>
				<?php if($model->read_sum == 0 || empty($model->read_sum) || ($model->read_sum % 2 != 0)):?>
				<?php 
				$this->beginWidget('WumiiJianWidget',array(
						'url'=>Yii::app()->createAbsoluteUrl('/site/view',array('id'=>$model->id)),
						'tag'=>$model->tag,
						'category'=>$model->type->name,
						'title'=>$model->title));?>
				<?php $this->endWidget();
				?>
				<?php else:?>
				<?php $this->beginWidget('TuiJianWidget');?><?php $this->endWidget();?>
				<?php endif;?>
			</section>
			<div class='divider'></div>
			
			
			<!-- 评论插件 -->
            <div id="disqus_thread"></div>
            <script type="text/javascript">
                /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
                var disqus_shortname = 'gowhich'; // required: replace example with your forum shortname

                /* * * DON'T EDIT BELOW THIS LINE * * */
                (function() {
                    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
                    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
                    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
                })();
            </script>
            <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
            <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
			
		</div>
	
		<div class='span3 right-container'>
			<?php $this->beginWidget('LeftNavWidget');?><?php $this->endWidget(); ?>
		</div>
	</div>
</div>